<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>04-事件入门</title>
    <style>
      #box1{
        width: 300px;
        height: 300px;
        border: 1px red solid;
      }
    </style>
    <script>
      window.onload = function () {
        // 获取按钮对象
        let button = document.getElementsByTagName("input")[0];
        // 获取div对象
        let box1 = document.getElementsByTagName("div")[0]
        // 绑定事件
        button.onclick = function () {
          // 编写事件
          box1.innerHTML = "xixi"
        }
      }
    </script>
</head>
<body>
        <div id="box1">

        </div>
        <input type="button" name="button" value="点我添加文字">
</body>
</html>